﻿package com._public._images 
{
	
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	/**
	* @author lbynet
	* @version 0.1
	*/
	public class BitMapUtil
	{
		
		public function BitMapUtil() 
		{
			
		}
		
		
		/* 简单贴图 */
		public static function drawBitmapData(draw_mc:Sprite, content_mc:Sprite = null, bitmap:BitmapData = null):void
		{
			
			var newBitmapData:BitmapData;
			var _width:Number;
			var _height:Number;
			if (content_mc)
			{
				_width = content_mc.width;
				_height = content_mc.height;
				newBitmapData= new BitmapData(content_mc.width, content_mc.height, true, 0);
				newBitmapData.draw(content_mc);
			}
			else
			{
				_width = draw_mc.width;
				_height = draw_mc.height;
				newBitmapData = bitmap;
			}
			
			draw_mc.graphics.clear();// 清除
			
			draw_mc.graphics.beginBitmapFill(newBitmapData);
			draw_mc.graphics.drawRect(0, 0, _width, _height);
			draw_mc.graphics.endFill();
		}
		
		
	}

}